package main

import (
	"fmt"
	"golang.org/x/sys/unix"
)

func main() {}
	statfs := &unix.Statfs_t{}
	err := unix.Statfs(path, statfs)
	if err != nil {
		println(err)
	}

	// Available is blocks available * fragment size
	available := int64(statfs.Bavail) * int64(statfs.Bsize)

	// Capacity is total block count * fragment size
	capacity := int64(statfs.Blocks) * int64(statfs.Bsize)

	// Usage is block being used * fragment size (aka block size).
	usage := (int64(statfs.Blocks) - int64(statfs.Bfree)) * int64(statfs.Bsize)

	inodes := int64(statfs.Files)
	inodesFree := int64(statfs.Ffree)
	inodesUsed := inodes - inodesFree

	fmt.Printf("available:%d, capacity:%d, usage:%d, inodes:%d, inodesFree:%d, inodesUsed:%d", available, capacity, usage, inodes, inodesFree, inodesUsed)
}
